<?php
/**
 * Created by PhpStorm.
 * User: mingzhongshui
 * Date: 2020/3/31
 * Time: 21:09
 */

namespace App\Repositories\User;

use App\Repositories\Repository;
use Illuminate\Support\Facades\DB;

/**
 * Class UserRepository
 * @package App\Repositories\User
 */
class UserLabelRepository extends Repository
{

    /**
     * @return string
     */
    public function model()
    {
        return \App\Models\User\UserLabelModel::class;
    }

    /**
     * @param array $labelIds
     * @return mixed
     */
    public function getUserByLabelIds(array $labelIds)
    {
        return $this->model
                    ->select(DB::raw('user_id as uid'))
                    ->whereIn('label_id', $labelIds)
                    ->groupBy('uid')
                    ->pluck('uid', 'uid');
    }
    
}
